﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Tailoring
{
    public partial class frmSetting : Form
    {
        SqlConnection conn = new SqlConnection("Server= localhost; database=tailoringmng; integrated Security=true");
        public frmSetting()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
            conn.Open();
            SqlCommand cmd = new SqlCommand("clothrate", conn);
                cmd.Parameters.AddWithValue("@id",1);
                
                cmd.Parameters.AddWithValue("@crate",txtrate.Text );
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.InsertCommand = cmd;
                adapter.InsertCommand.ExecuteNonQuery();
                cmd.Connection.Close();
                MessageBox.Show("Cloth Rate has Been Save Successfully ", "Save Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
            finally
            {
                this.conn.Close();

            }
        }
    }
}
